package org.lakeside.outreach.client;

import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.FlexTable;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HorizontalPanel;

public class ProjectDetailPanel extends Composite {
	
	private WindowPanel window = new WindowPanel("Project Details");
	private FlexTable statsPanel = new FlexTable();
	private HTML description = new HTML();
	private HTML volunteerHours = new HTML();
	private HTML staffHours = new HTML();
	private HTML cost = new HTML();
	private HTML referrals = new HTML();
	private Project project;
	private EventListPanel eventPanel = new EventListPanel();
	
	public ProjectDetailPanel() {
		description.setWordWrap(true);
		
		// create header for stats table
		statsPanel.setText(0, 0, "Volunteer Hours");
		statsPanel.setText(0, 1, "Staff Hours");
		statsPanel.setText(0, 2, "cost");
		statsPanel.setText(0, 3, "Referrals");
		
		// instantiate values for stats table
		statsPanel.setWidget(1, 0, volunteerHours);
		statsPanel.setWidget(1, 1, staffHours);
		statsPanel.setWidget(1, 2, cost);
		statsPanel.setWidget(1, 3, referrals);
		
		window.add(statsPanel);
		window.add(description);
		window.add(eventPanel);
		window.setWidth("100%");
		
		initWidget(window);
	}
	
	public void setProject(Project project) {
		this.project = project;
		volunteerHours.setHTML("0");
		staffHours.setHTML("0");
		cost.setHTML("0");
		referrals.setHTML("0");
		description.setHTML(project.getDescription());
		eventPanel.setEvents(project.getEvents());
	}

}
